Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
@cosmjs/tendermint-rpc
Advanced tools
@cosmjs/tendermint-rpc is an npm package that provides a client for interacting with Tendermint-based blockchains. It allows developers to query blockchain data, subscribe to events, and broadcast transactions using Tendermint's RPC protocol.
Querying Blockchain Data
This feature allows you to query various pieces of information from the blockchain, such as the current status, block information, and more. The code sample demonstrates how to connect to a Tendermint node and fetch its status.
const { Tendermint34Client } = require('@cosmjs/tendermint-rpc');
async function queryBlockchain() {
const client = await Tendermint34Client.connect('http://localhost:26657');
const status = await client.status();
console.log(status);
}
queryBlockchain();
Subscribing to Events
This feature allows you to subscribe to various events happening on the blockchain, such as new blocks being created. The code sample demonstrates how to subscribe to new block events and handle them.
const { Tendermint34Client, SubscriptionEventType } = require('@cosmjs/tendermint-rpc');
async function subscribeToEvents() {
const client = await Tendermint34Client.connect('http://localhost:26657');
const subscription = client.subscribe({
query: 'tm.event = "NewBlock"'
});
subscription.addListener(SubscriptionEventType.NewBlock, (event) => {
console.log('New block event:', event);
});
}
subscribeToEvents();
Broadcasting Transactions
This feature allows you to broadcast transactions to the blockchain. The code sample demonstrates how to connect to a Tendermint node and broadcast a sample transaction.
const { Tendermint34Client } = require('@cosmjs/tendermint-rpc');
async function broadcastTransaction(tx) {
const client = await Tendermint34Client.connect('http://localhost:26657');
const result = await client.broadcastTxCommit({ tx });
console.log(result);
}
const sampleTx = new Uint8Array([0x00, 0x01, 0x02]);
broadcastTransaction(sampleTx);
The 'tendermint' npm package provides a client for interacting with Tendermint nodes. It offers similar functionalities such as querying blockchain data, subscribing to events, and broadcasting transactions. However, it may not be as actively maintained or feature-rich as @cosmjs/tendermint-rpc.
The 'cosmos-client' npm package is designed for interacting with Cosmos SDK-based blockchains. It provides functionalities for querying blockchain data, managing accounts, and broadcasting transactions. While it offers similar features, it is more focused on the Cosmos SDK ecosystem compared to the more general Tendermint focus of @cosmjs/tendermint-rpc.
The 'tendermint-rpc' npm package is another client for interacting with Tendermint nodes. It provides basic functionalities for querying blockchain data and broadcasting transactions. It is simpler and may lack some of the advanced features and optimizations found in @cosmjs/tendermint-rpc.
This package provides a type-safe wrapper around
Tendermint RPC. Notably, all binary
data is passed in and out as Uint8Array
, and this module is reponsible for the
hex/base64 encoding/decoding depending on the field and version of Tendermint.
Also handles converting numbers to and from strings.
This package is part of the cosmjs repository, licensed under the Apache License 2.0 (see NOTICE and LICENSE).
FAQs
Tendermint RPC clients
The npm package @cosmjs/tendermint-rpc receives a total of 84,802 weekly downloads. As such, @cosmjs/tendermint-rpc popularity was classified as popular.
We found that @cosmjs/tendermint-rpc demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.